//new table用
var cols1 = [
    {name: 'id', display: 'id', width: 0, type: 'text', disabled: false},
    {name: 'intime', display: '入住时间', width: 80, type: 'text', disabled: true},
    {name: 'outtime', display: '离店时间', width: 80, type: 'text', disabled: true},
    {name: 'name', display: '酒店名称', width: 180, type: 'text', disabled: true},
    {name:'kind',display:'房型',width:100,type:'text', disabled: true}
];

var cols = [
    {name: 'name', display: '名称', width: 40, type: 'text', disabled: true},
    {name: 'type', display: '类型', width: 40, type: 'text', disabled: true,text_align:"left"},
    {name: 'discription', display: '描述', width: 150, type: 'text', disabled: true,text_align:"left"},
    {name:'default',display:'默认值',width:40,type:'text', disabled: true,text_align:"left"}
];

var rows = [
    {"name": "title", "type": "string", "discription": "表格标题文本", "default": "''"},
    {"name": "title_align", "type": "string(left,right,center)", "discription": "表格标题文本对齐方式", "default": "center"},
    {"name": "th_align", "type": "string(left,right,center)", "discription": "表格列标题文本对齐方式", "default": "left"},
    {"name": "bar", "type": "boolean", "discription": "表头是否显示", "default": "false"},
    {"name": "height", "type": "string(..px)", "discription": "表格整体的高度 内容过高则出现滚动条", "default": "auto"},
    {"name": "width", "type": "string(..px)", "discription": "表格整体的宽度 内容过大则出现滚动条", "default": "auto"},
    {"name": "footerheight", "type": "string(..px)", "discription": "表格底部的高度(用于摆放按钮及合计等)", "default": "0"},
    {"name": "footer", "type": "string(..px)", "discription": "表格底部包含的元素 将实现后的html用&lt;div slot=footer&gt; 包裹即可", "default": "''"},
    {"name": "autoLoad", "type": "boolean", "discription": "是否自动加载数据", "default": "true"},
    {"name": "loadUrl", "type": "string", "discription": "加载数据地址", "default": "''"},
    {"name": "loadParam", "type": "", "discription": "", "default": ""},
    {"name": "alternatecolor", "type": "boolean", "discription": "表格行背景颜色交替", "default": "true"},
    {"name": "cols", "type": "[ ]", "discription": "列模型", "default": "''"},
    {"name": "rows", "type": "[ ]", "discription": "行数据", "default": "''"},
    {"name": "bordertype", "type": "string(all,bottom)", "discription": "表格边框类型", "default": "all"}

];
//newgrid用
var newgridcols = [
    {name: 'id', display: '编号', width: "100%", type: 'text', disabled: false},
    {name: 'name', display: '名称', width: 150, type: 'text', disabled: true},
    {name: 'price', display: '价格', width: 120, type: 'text', disabled: true},
    {name: 'category', display: '类别', width: 150, disabled: true, type: 'select', option: {
        'A1': '游戏', 'A2' : '电影', 'A3' : '音乐'
    }}
];
var newgridrows = [
    {"id": "001", "name": "超长字段超长字段超长字段超长字段超长字段超长字段超长字段",   "price": "$0.87", "category": "A1", "selected": "false"},
    {"id": "002", "name": "YuJun",    "price": "$0.57", "category": "A2", "selected": "false"},
    {"id": "003", "name": "YingYing", "price": "$1.11", "category": "A3", "selected": "true"},
    {"id": "004", "name": "HaHa",     "price": "$0.89", "category": "A2", "selected": "false"},
    {"id": "005", "name": "Eclair",   "price": "$0.77", "category": "A3", "selected": "false"}
]

define(["../../component/newtable/avalon.newtable","../../component/newgrid/avalon.newgrid"], function(){
    var tv = avalon.define({
        $id:"test1",
        $tableviewcfg1:{
            title_align:"center",
            title:"小倩",
            loadUrl:'../json/td.table1.json',
            cols:cols1,
            autoLoad:true,
            bar:false,
            alternatecolor:false,
            th_display:true,
            bordertype:'bottom'
        },
        $tableviewcfg2:{
            title_align:"center",
            title:"Newtable组件表格属性",
            cols:cols,
            rows:rows,
            autoLoad:true,
            bar:true
        },
        $tableviewcfg3:{
            title_align:"left",
            title:"NewGrid组件,适用于带有编辑功能的表格",
            checkbox:true,
            singleSelect:false,
            editable:true,
            autoLoad:true,
            pagerbar:true,
            limit:2,
            //loadUrl: './json/td.datagrid.json',
            //loadParam: {
            //    "total":"5","rspcod" :"200","rspmsg":"","rows":'23'
            //},
            afterAjax:function(){
                console.log(111)
            },
            onrowclicked:function(){
                console.log(2222)
            },
            cols: newgridcols,
            rows:newgridrows
        }


    });
    return tv;
});